package cc.cix.hq.org.service.impl;


import cc.cix.hq.common.core.entity.QueryRequest;
import cc.cix.hq.common.core.entity.org.DataPermissionTest;
import cc.cix.hq.org.mapper.DataPermissionTestMapper;
import cc.cix.hq.org.service.IDataPermissionTestService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * @author cix
 */
@Service
public class DataPermissionTestServiceImpl extends ServiceImpl<DataPermissionTestMapper, DataPermissionTest> implements
        IDataPermissionTestService {

    @Override
    public IPage<DataPermissionTest> listDataPermissionTest(QueryRequest request, DataPermissionTest dataPermissionTest) {
        IPage<DataPermissionTest> objectPage = new Page<>(request.getPageNum(), request.getPageSize());
        LambdaQueryWrapper<DataPermissionTest> lew = new LambdaQueryWrapper<DataPermissionTest>().orderByAsc(DataPermissionTest::getCreateTime);
        IPage<DataPermissionTest> page = page(objectPage, lew);
        page.setTotal(count(lew));
        return page;
    }
}
